#{extends 'admintemplate.html' /}
#{set title:'Category' /}
#{set active:'active' /}

#{set main_title:'Quản Lý Danh Mục'/}
#{set sub_title:'Thêm/Xóa/Sữa Danh Mục'/}
#{set 'moreScripts'}
      <script src="@{'/public/admin/js/bootstrap-modal.js'}" type="text/javascript"></script>
#{/set}
<div class="span12">
	#{if categories.size() !=0 }
		<table id="product-table">
		<tr>
			<th class="table-header-repeat line-left minwidth-1"><a href="">Id</a>	</th>
			<th class="table-header-repeat line-left minwidth-1"><a href="">Name</a></th>
			<th class="table-header-repeat line-left"><a href="">Alias</a></th>
			<th class="table-header-repeat line-left"><a href="">Description</a></th>
			<th class="table-header-repeat line-left"><a href="">Image</a></th>
			<th class="table-header-repeat line-left"><a href="">Box</a></th>
			<th class="table-header-repeat line-left"><a href="">Control</a></th>
		</tr>
		#{list items: categories, as:'category'}
			<tr class="content_${content?.id}" id="col_${category_parity}">
				<td>${category?.id}</td>
				<td>${category?.name}</td>
				<td>${category?.alias}</td>
				<td>${category?.description}</td>
				<td><a href="">${category?.imagePath}</a></td>
				<td>${category?.box}</td>
				<td><a href="/admin/deleteCategory/${category?.id}"> Delete </a>
				<a href="/admin/viewEditCategory/${category?.id}"> Edit </a>
			</tr>
		#{/list}
		
		</table>
	#{/if}
	#{else}
		Không Có Danh Mục
	#{/else}
	<div style="padding: 16px 19px;" class="well">
		<form class="form" enctype="multipart/form-data" method="post" action="/admin/createCategory" id="addCategoryForm">
			<fieldset>
			    <div class="clearfix">
					<div class="input">
						<h2 style="color: red;">Create Category</h2>
					</div>
				</div>
				<div class="clearfix">
					<label for="name">Name</label>
					<div class="input">
						<input type="text" name="name">
					</div>
				</div>
				<div class="clearfix">
					<label for="data">File</label>
					<div class="input">
						<input type="file" name="data">
					</div>
				</div>
				<div class="clearfix">
					<label for="description">Description</label>
					<div class="input">
						<textarea name="description" cols="200" rows="5"></textarea>
					</div>
				</div>

				<div class="clearfix">
					<label for="selectbox">Select list</label>
					<div class="input">
						<select name="selectbox">
							<option value="dongphuc">Đồng Phục</option>
							<option value="bhld">Bảo Hộ Lao Động</option>
						</select>
					</div>
				</div>

				<input type="hidden" name="categoryId">
				<div class="actions">
					<input type="submit" value="Thêm/Cập nhật" class="btn primary">
				</div>
			</fieldset>
		</form>
	</div>
</div>
